package com.abcdefg.rabbitmqextensionsdemo.config;


import com.abcdefg.rabbitmqextensionsdemo.constants.Constant;
import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QusConfig {

    @Bean("qusExchange")
    public DirectExchange qusExchange() {
        return ExchangeBuilder.directExchange(Constant.QUS_EXCHANGE).build();
    }

    @Bean("bindingQusQueue")
    public Binding bindingQusQueue(@Qualifier("qusQueue") Queue queue,
                                   @Qualifier("qusExchange") Exchange exchange) {
        return BindingBuilder.bind(queue).to(exchange).with("qus").noargs();
    }
    @Bean("qusQueue")
    public Queue qusQueue() {
        return QueueBuilder.durable(Constant.QUS_QUEUE).build();
    }

}
